<?php

//initialize the session
if (!isset($_SESSION)) {
@session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
  $_SESSION['MM_id_target']=NULL;
	$_SESSION['MM_aut_target']=NULL;
	$_SESSION['MM_nmb_target']=NULL;
	$_SESSION['MM_tp_programa']=NULL;
	$_SESSION['MM_id_candidato']=NULL;
	$_SESSION['MM_id_empresa']=NULL;
	
  $logoutGoTo = "../private/login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>

<?php
if (!isset($_SESSION)) {
 @session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "../private/login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>

<?php require_once('../Connections/miportal.php'); 
mysql_query("SET NAMES 'utf8'");?>
<?php
$convocatoria=$_SESSION['MM_id_cat_convocatoria'];
mysql_select_db($database_miportal, $miportal);
$query_rs_ies = "SELECT * FROM cor_ies_beneficiada LEFT JOIN cat_ies USING (id_cat_ies) LEFT JOIN cat_convenio USING (id_cor_ies_beneficiada) LEFT JOIN cor_digital_ies USING (id_cor_ies_beneficiada) WHERE id_cat_convocatoria=$convocatoria AND tp_status_vigencia=1 ORDER BY id_nmbNombre ASC";
$rs_query = mysql_query($query_rs_ies, $miportal) or die(mysql_error());
$row_rs_ies = mysql_fetch_assoc($rs_query);
$totalRows_rs_ies = mysql_num_rows($rs_query);
?>


<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximun-scale=1">
<title>FUNDACIÓN EDUCACIÓN SUPERIOR-EMPRESA</title>
<!--Hoja de estilo principal-->
<link href="../css/styletd2.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" type="text/css" href="../css/menu.css"><!--Pemanggilan gambar favicon-->
<link rel="stylesheet" type="text/css" href="../css/mos-style.css">
 <!--pemanggilan file css-->
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script language=""="JavaScript">
	function conMayusculas(field) {
				field.value = field.value.toUpperCase()
		}
			function incubadora(val) {
				documen.write(val);
		}
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}

	function confirmar ( mensaje ) {
					return confirm( mensaje );
				}
        </script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">


</head>

<body>
 
 <header>
        <div id="background"></div><!--BackGround Menu header-->
		<div class="img_header_logo"></div>
		<span class="img_header_logo"><a href="http://fese.org.mx"><img src="../images/fese/FESE_home_logo.png"  height="90" alt="FESE" align="bottom" /></a></span>
		<div class="img_header_logo"></div>
		<?php include_once('../include/juridico_nav.php');?>
</header>

<center>
<div id="boxcontainer" style="width:1280px">
<div id="container">


  <p>&nbsp;</p>
  
  <h2 align="left">IES participantes en esta convocatoria: <?php echo $totalRows_rs_ies?></h2>
  
  <!--<table width="720" border="0" cellspacing="0" cellpadding="0"> -->
  
  <table width="960px" border="1"> 
  	  <th class="data" scope="col">NO.</th>  
	  <th class="data" scope="col">IES</th>
      <th class="data" scope="col">Solicitud</th>
      <th class="data" scope="col">Enviado</th>
      <th class="data" scope="col">Validado</th>
      <th class="data" scope="col">En firma</th>
      <th class="data" scope="col">Digitalizado</th>
      <th class="data" scope="col">Enviado IES</th>
      <th class="data" scope="col">Entregado IES</th>
      <th class="data" scope="col">Guardar Cambios</th>
       </tr>
    
    
    
    
   
  
    <?php
   $counter=1;
   if($row_rs_ies!=0){
    do { ?>
      <tr >
      	<td class="data"><?php echo $counter; ?></td><!--NUMERO-->
        <td class="data"><?php if(isset($row_rs_ies['url_cat_convenio'])&&!empty($row_rs_ies['url_cat_convenio'])){?>
		<a href="<?php echo $row_rs_ies['url_cat_convenio']?>" target="_blank"><?php echo $row_rs_ies['id_nmbNombre'];?></a>
		<?php }else echo $row_rs_ies['id_nmbNombre']; ?></td>
        
        <form name="juridico_exp" method="POST" action="../form/form_juridico_convenio.php">
        <td class="data">
        <input name="solicitud" type="checkbox" 
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=1){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_solicitud'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==0){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             >
        </td>
        <td class="data"><input name="enviado" type="checkbox" 
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=2){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_enviado_firma'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==1){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             >
        </td>
        <td class="data"><input name="validado" type="checkbox"  
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=3){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_validando'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==2){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             ></td>
        <td class="data"><input name="enfirma" type="checkbox"  
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=4){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_en_firma'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==3){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             ></td>
        <td class="data"><input name="digitalizado" type="checkbox"  
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=5){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_digitalizado'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==4){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             ></td>
        <td class="data"><input name="enviadofinal" type="checkbox"  
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=6){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_envio_ies'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==5){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             ></td>
        <td class="data"><input name="entregado" type="checkbox"  
         <?php if(isset($row_rs_ies['tp_status_convenio'])
		 			&&$row_rs_ies['tp_status_convenio']>=7){?> 
         checked="true" disabled="true" title="<?php echo $row_rs_ies['fh_entrega_ies'];?>" <?php 
		 }else if(
		 $row_rs_ies['tp_status_convenio']==6){
			 ?> enabled="true"
			 <?php } else{ ?> disabled="true" <?php } ?>
             ></td> 
        <td class="data">
        <input name="Guardar" type="submit" value="Guardar">
        <input name="object" type="hidden" value="<?php echo base64_encode($row_rs_ies['id_cor_ies_beneficiada']+261)?>">
        <input name="MM_update_convenio" id="MM_update_convenio" type="hidden" value="formConvenio">
        
        </td>      
        </form>
      </tr>
      <?php
	  
	  $counter++;
	   } while ($row_rs_ies = mysql_fetch_assoc($rs_query));
   }
	    ?>           

        
 </table>
  
    
    
  
  <p align="left">&nbsp;</p>
  <p align="left">&nbsp;</p>
    
  
</div>
<!--Container-->
<?php include_once('../include/coa_rigth_container.php');?>
</div><!--Boxcontainer-->
</center>
  
 
</body>
</html>

